package com.lsp.base.view.scrollview;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ScrollView;

/**
 * Created by wangzhejun on 16/8/26.
 */
public class ScrollChangeScrollView extends ScrollView {

  private IScrollChangedListener scrollViewListener = null;

  public ScrollChangeScrollView(Context context) {
    super(context);
  }

  public ScrollChangeScrollView(Context context, AttributeSet attrs) {
    super(context, attrs);
  }

  public ScrollChangeScrollView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
  }

  public void setScrollChangedListener(IScrollChangedListener listener) {
    this.scrollViewListener = listener;
  }

  @Override protected void onScrollChanged(int l, int t, int oldl, int oldt) {
    super.onScrollChanged(l, t, oldl, oldt);
    if (scrollViewListener != null) {
      scrollViewListener.onScrollChanged(this, l, t, oldl, oldt);
    }
  }
}
